<template>
  <view class="sszbo-container">
    <image class="kv-img" src="https://scoringchina.oss-cn-beijing.aliyuncs.com/biemlfGolf/kkk.jpg" mode="widthFix" />
    <!-- <view class="btn-list" v-for="(item, index) in groupList" :key="index">
      <view class="btn-item btn-red" @click="onBtnClick(item)">
        <image class="btn-icon" :src="item.thumb" mode="aspectFit" />
      </view>
    </view> -->
    	<view class="btn-list" v-for="(item, index) in groupList" :key="index">
	  <view class="btn-item btn-red" @click="onBtnClick(item)">
	    <image class="btn-icon" :src="item.thumb" mode="" />
	  </view>
	   
	</view>
  </view>
</template>
<script>
export default {
  name: "SszboPage",
  data() {
    return {
      richTextContent: "",
      groupType: '',
      groupList: []
    }
  },
  onLoad(e) {
    console.log('-----------1------22-----', e.group)
    this.groupType = e.group
    
    this.fetchNews();

  },
  methods: {
    onBtnClick(item) {
      console.log('--------1-----------',item);
      // 跳转视频播放页面，传递视频链接
      if(item && item.video_url) {
        uni.navigateTo({
          url: `/pages/video/index?url=${encodeURIComponent(item.video_url)} &title=${encodeURIComponent(item.title)}`
        });
      } else if(item && item.link_url) {
        // window.open(item.link_url)
		
        window.location.href = item.link_url
		}
    },
       async fetchNews() {
      let urlstr;
      if (this.groupType == 'AB组') {
        urlstr = 'http://chaoxiang.scoringchina.com/index/api/jingcai_zhibo_ab';
      } else { 
        urlstr = 'http://chaoxiang.scoringchina.com/index/api/jingcai_zhibo_cd';
      }
      try {
        const res = await uni.request({
          url: urlstr,
          method: 'GET'
        });
        if(res && res.data && res.data.code === 1) {
         this.groupList = res.data.data || [];
          console.log('-------this.groupList----2-----------', this.groupList)

        } else {
          console.error('获取数据失败', res[1]);
        }
      } catch (error) {
        console.error('请求异常', error);
      }
    },
  }
}
</script>
<style scoped>
.sszbo-container {
  min-height: 100vh;
  background: #f6f8fa;
  padding-bottom: 40rpx;
}
.kv-img {
  width: 100vw;
  display: block;
}
.btn-list {
  margin-top: 24rpx;
  display: flex;
  flex-direction: column;
  gap: 24rpx;
  padding: 0 24rpx;
}
.btn-item {
  min-height: 120rpx;
  border-radius: 20rpx;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.btn-label {
  font-size: 38rpx;
  color: #fff;
  font-weight: bold;
  letter-spacing: 2rpx;
}

.btn-list {
  margin-top: 24rpx;
  display: flex;
  flex-direction: column;
  gap: 24rpx;
  padding: 0 24rpx;
}
.btn-item {
  min-height: 120rpx;
  border-radius: 20rpx;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.08);
  position: relative;
  overflow: hidden;
}
.btn-label {
  font-size: 38rpx;
  color: #fff;
  font-weight: bold;
  letter-spacing: 2rpx;
}
.btn-icon {
  width: 704rpx;
  height: 13.07rem;
}
</style>
